package com.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 直连消息
 */
@Configuration
public class RabbitDirectConfig {
    public final static String DIRECTNAME = "javaboy-direct";

    /****
     * 创建队列Queue
     * @return
     */
    @Bean
    Queue queue() {
        return new Queue("hello.javaboy");
    }
    
    /****
     * 创建交换机  可以不用
     * @return
     */
    /**
    @Bean
    DirectExchange directExchange() {
        return new DirectExchange(DIRECTNAME, true, false);
    }
    **/
    /****
     * 创建绑定器  绑定队列和交换机   可以不用
     * @return
     */
    /***
    @Bean
    Binding binding() {
        return BindingBuilder.bind(queue()).to(directExchange()).with("direct");
    }
    ***/
}
